package com.bwie.system.controller;

import com.bwie.common.domain.Goods;
import com.bwie.common.result.Result;
import com.bwie.system.service.GoodsService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    /**
     * 商品表展示
     */
     @PostMapping("goodsList")
     private Result  goodsList(@RequestBody Goods goods){
        PageInfo<Goods> pageInfo = goodsService.goodsList(goods);
        return Result.success(pageInfo);

     }
    /**
     * 下单
     */
    @PostMapping("addGoods")
    private Result addGoods(@RequestBody List<Integer>goodsIds){
        goodsService.addGoods(goodsIds);
        return Result.success();
    }


}
